/**
 * Created by jimmy on 2017/6/10.
 */

var prodDao = require("../dao/ProdDao");
var async = require("async");

exports.getProdList = function (typeId,callbk) {
    prodDao.getProdList(typeId,callbk);
}

exports.getTypeList = function (callbk) {
    prodDao.getTypeList(callbk);
}

exports.getPdlist = function (callbk) {
    async.waterfall([
        function (callbk) {
            prodDao.getTypeList(callbk);
        },function (typeids,callbk) {
             var typeId = typeids[0].type_id;
             prodDao.getProdList(typeId,callbk);
        }
    ],function (err,result) {
        if(err){
            console.log(err);
        }else {
            console.log(result);
            callbk(null,result);
        }
    });
}

exports.getProd = function (prodId,callbk) {
    prodDao.getProd(prodId,callbk);
}

exports.getProdDetail = function (prodId,dtype,callbk) {
    prodDao.getProdDetail(prodId,dtype,callbk);
}

exports.getMainProd = function (callbk) {
    prodDao.getMainProd(callbk);
}